import request from '@/utils/http'

/**
 * @desc 媒体类型获取接口
 * @returns 
 */
export const MediaList = () => {
  return request({
    method: 'get',
    url: '/media/list',
  })
}

/**
 * @desc 平台获取接口
 * @returns 
 */
export const PlatformList = () => {
  return request({
    method: 'get',
    url: '/platform/list',
  })
}

/**
 * @desc 媒体分页查询接口
 */
export const PageMedia = data => {
  return request({
    method: 'post',
    data,
    url: '/media/pageMedia',
  })
}

/**
 * @desc 新增媒体接口
 */
export const AddMedia = data => {
  return request({
    method: 'post',
    data,
    url: '/media/addMedia',
  })
}
/**
 * @desc 编辑媒体接口
 */
export const EditMedia = data => {
  return request({
    method: 'post',
    data,
    url: '/media/editMedia',
  })
}
/**
 * @desc 删除媒体接口
 */
export const DeleteMedia = params => {
  return request({
    method: 'post',
    url: '/media/delMedia/' + params,
  })
}

/**
 * @desc 获取对应的账号信息
 * @param {*} mediaId 
 * @returns 
 */
export const SearchAccountByMediaId = mediaId => {
  return request({
    method: 'get',
    url: `/media/searchAccountByMediaId/${mediaId}`,
  })
}

/**
 * @desc 新增媒体账户
 * @param {*} data 
 * @returns 
 */
export const MediaAddAccount = data => {
  return request({
    method: 'post',
    data,
    url: `/media/addAccount`,
  })
}

/**
 * @desc 编辑媒体账户
 * @param {*} data 
 * @returns 
 */
export const MediaEditAccount = data => {
  return request({
    method: 'post',
    data,
    url: `/media/editAccount`,
  })
}

/**
 * @desc 删除媒体账户
 * @param {*} id 
 * @returns 
 */
export const MediaDeleteAccount = id => {
  return request({
    method: 'post',
    url: `/media/delAccount/${id}`,
  })
}

/**
 * @desc 根据账户id获取子账号列表
 * @param {*} accountId 
 * @returns 
 */
export const GetViscountByAccountId = accountId => {
  return request({
    method: 'get',
    url: `/media/getViscountByAccountId/${accountId} `,
  })
}

/**
 * @desc 新增子账户
 * @param {*} data 
 * @returns 
 */
export const addViscount = data => {
  return request({
    method: 'post',
    data,
    url: `/media/addViscount`,
  })
}

/**
 * @desc 编辑子账户
 * @param {*} data 
 * @returns 
 */
export const editViscount = data => {
  return request({
    method: 'post',
    data,
    url: `/media/editViscount`,
  })
}

/**
 * @desc 删除子账户
 * @param {*} id 
 * @returns 
 */
export const delViscount = id => {
  return request({
    method: 'post',
    url: `/media/delViscount/${id}`,
  })
}

/**
 * @desc 子账户导入
 * @param {*} id 
 * @returns 
 */
export const importMediaAccount = (id, data) => {
  return request({
    method: 'post',
    url: `/file/importMediaAccount/${id}`,
    data
  })
}